﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <title>AI销售</title>
    <link rel="stylesheet" type="text/css" href="../plugins/weui/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css">
    <link rel="stylesheet" type="text/css" href="../css/css.css">
    <link rel="stylesheet" href="../plugins/dropload/css/mescroll.min.css">
    <link rel="stylesheet" type="text/css" href="../css/radar.css">
</head>
<body>
  <div class="container">
    <div class="weui-flex">
      <div class="weui-flex__item navbar">
          <a href="bossRadarIndex.html">
              <div class="placeholder">时间</div>
              <div class="border"></div>
          </a>
      </div>
      <div class="weui-flex__item navbar active_navbar">
          <a href="bossRadarSecond.html">
              <div class="placeholder">行为</div>
              <div class="border" style="display:block"></div>
              </a>
        </div>
      <div class="weui-flex__item navbar">
          <a href="bossRadarThree.html">
              <div class="placeholder">人</div>
              <div class="border"></div>
              </a>
        </div>
    </div>
    <div class="weui-tab__panel">
        <!--滑动区域-->
        <div id="mescroll" class="mescroll">
            <!--展示上拉加载的数据列表-->
            <div class="mslist" style="display:block">
            </div>
            <div style="height:60px;"></div>
        </div>
        
    </div>
    <div class="weui-tabbar tabbar">
      <a href="bossRadarIndex.html" class="weui-tabbar__item">
        <img src="../images/tabbar/9.png" alt="" class="weui-tabbar__icon">
        <p class="weui-tabbar__label" style="color:#FD4D01;">AI销售</p>
      </a>
      <a class="weui-tabbar__item a_msg_list">
        <img src="../images/tabbar/12.png" alt="" class="weui-tabbar__icon">
        <p class="weui-tabbar__label">消息</p>
      </a>
      <a href="contactPerson.html" class="weui-tabbar__item">
        <img src="../images/tabbar/14.png" alt="" class="weui-tabbar__icon">
        <p class="weui-tabbar__label">客户</p>
      </a>
      <a href="contactPerson.html" class="weui-tabbar__item">
        <img src="../images/tabbar/16.png" alt="" class="weui-tabbar__icon">
        <p class="weui-tabbar__label">商圈</p>
      </a>
      <a href="myself.html" class="weui-tabbar__item">
        <img src="../images/tabbar/18.png" alt="" class="weui-tabbar__icon">
        <p class="weui-tabbar__label">我</p>
      </a>
    </div>
  </div>
  <div id="dialog1" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
      <div class="weui-dialog__hd">
        <strong class="weui-dialog__title">选择时间段</strong>
      </div>
      <div class="weui-dialog__bd">
        <div class="bd_input">
          <span id="startTime" style="margin-left:5px;"></span>
          <img src="../images/pk/50.png" alt="" onclick="startTime()">
        </div>
        <span class="bd_span">至</span>
        <div class="bd_input">
          <span id="endTime" style="margin-left:5px;"></span>
          <img src="../images/pk/50.png" alt="" onclick="endTime()">
        </div>
      </div>
      <div class="weui-dialog__ft">
        <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default" onclick="closeTime()">取消</a>
        <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" onclick="okTime()">确定</a>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="../js/jquery-2.1.4.min.js"></script>
  <script type="text/javascript" src="../plugins/weui/js/weui.min.js"></script>
  <script src="../plugins/dropload/js/mescroll.min.js"></script>
  <script src="../js/base.js"></script>
  <script src="../js/rader.js"></script>
  <script type="text/javascript">
      var mescroll = getPager(load);
      $(function () {
          loadBtn();
         // return login();
    });

      function load(pageObj) {
          ajaxGet(siteApiList.BehaviorDetail + '?actiontype='+getQueryString('actiontype')+'&staffid=' + staffId + '&page=' + pageObj.num, function (data) {
              if (!isJsonSuccess(data)) {
                  mescroll.endErr();
                  return;
              }
              mescroll.endSuccess(data.Data == null ? 0 : data.Data.length);  //设置条数

              if (isNoData(data.Data)) {
                  $('.mslist').append(getNoDataMsg(pageObj.num));
                  return;
              }
              
              $('.mslist').append(function () {
                  var arr = [];
                  $.each(data.Data, function (index, items) {
                      var todaystart = new Date();
                      todaystart.setHours(0);
                      todaystart.setMinutes(0);
                      todaystart.setSeconds(0);
                      todaystart.setMilliseconds(0);

                      var todayend = new Date();
                      todayend.setHours(23);
                      todayend.setMinutes(59);
                      todayend.setSeconds(59);
                      todayend.setMilliseconds(59);

                      var datestr = Date.parse(items.addtime.replace(/-/g, "/"));
                      if (datestr >= todaystart.getTime() && datestr <= todayend.getTime())
                          datestr = dateFtt('hh:mm', new Date(items.addtime.replace(/-/g,"/")))
                      else
                          datestr = dateFtt('yyyy/MM/dd hh:mm', new Date(items.addtime.replace(/-/g, "/")));
                      arr.push('<div class="time-tit">' + datestr + '</div>');
                      $.each(items.rtmList, function (index, item) {
                          arr.push('<div class="weui-cells"><a class="weui-cell weui-cell_access" onclick=\"toClientDetail(' + item.uid + ',' + item.staffId + ')\"  href="javascript:;"><div class="weui-cell__hd"><div class="avatar"><img class="avatar-img" src="' +
                          siteConfig.formatAvater(item.avatar) + '" alt=""></div></div><div class="weui-cell__bd"><p style="margin-left:10px;">' + item.nickname + loaddata(item.actionType, item.num) + '</p></div><div class="weui-cell__ft"></div></a></div>');
                      });
                  });
                  return arr.join('');
              });             
          })
      }

    function loaddata(obj,num) {
        var res;
        if (obj == 0) 
            res = "查看了您公司的商品";
        else if (obj == 1) 
            res = "查看了您公司的官网";
        else if (obj == 2) 
            res = "复制了您公司的微信";
        else if (obj == 3) 
            res = "转发了您公司的名片";
        else if (obj == 4) 
            res = "查看了您公司的名片";
        else if (obj == 5) 
            res = "复制了您公司的动态";
        else if (obj == 6) 
            res = "咨询了您公司的产品";
        else if (obj == 7) 
            res = "保存了您公司的电话";
        else if (obj == 8) 
            res = "觉得您公司靠谱";
        else if (obj == 9) 
            res = "拨打了您公司的电话";
        if (num <= 1)
            res += "，看来TA对公司感兴趣";
        else
            res += "第" + num + "次,成交在望";
        return res;
    }
    function dateFtt(fmt, date) { //author: meizz   
        var o = {
            "y+": date.getFullYear(),
            "M+": date.getMonth() + 1,                 //月份   
            "d+": date.getDate(),                    //日   
            "h+": date.getHours(),                   //小时   
            "m+": date.getMinutes(),                 //分   
            "s+": date.getSeconds(),                 //秒   
            "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
            "S": date.getMilliseconds()             //毫秒   
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }

    function loadBtn() {
        //聊天会话链接
        $(".a_msg_list").click(function () {
            toUrl(siteUrlList.ImMessageList + "?uid=" + userid);
        });
        var index;
        $('.placeholder').on('click', function () {
            index = $(this).parents('.weui-flex__item').index()
            $(this).parents('.weui-flex__item').addClass('active_navbar').siblings().removeClass('active_navbar');
            $(this).parents().children('.border').css('display', 'block').parents().siblings().children('.border').css(
              'display', 'none')
            $('.weui-tab__panel').children().eq(index).css('display', 'block').siblings().css('display', 'none')
        });
        $('.choose-time').on('click', function () {
            $('#dialog1').css('display', 'block');
            /* Act on the event */
        });       
    }

    function toClientDetail(uid, staffid) {
        window.location = "customerDetail.html?clientid=" + uid + "&staffId=" + staffid;
        console.log(uid)
    }
  </script>
</body>

</html>